Zelda 2 Music format v 0.5 by Optomon ------------------------ Data for sound/music in Zelda 2 is located in the data block from 0x : 18010-1C00F Table of Contents ------------------------------- I. TITLE SCREEN MUSIC II. PHRASES 2A) Phrase Format 2B) Phrase Order III. NOTATION 3A) Pitch 3B) Duration IV. TIMBRE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX I. TITLE SCREEN MUSIC XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The data for the title screen theme as well as the sound effects used in the name entry screen are stored separately from the music and sound of the rest of the game. It is stored in the block 18010-1879B. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX II. PHRASES XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This is in my opinion the most irritating part about Zelda 2's music format. Instead of the music being arranged song by song, it is arranged phrase by phrase A "phrase" in this case is a part of the song lasting a certain number of measures. so songs in Zelda 2 are essentially a bunch of mini-songs stitched together making one big song. For example, the the first phrase of the overworld song is the intro part that plays the original Legend of Zelda theme. The second theme is the part following that repeats twice over. The maximum length a phrase can be defined is 16 whole notes, but this doesn't mean that all of them are. The first phrase of the overworld theme is 16 whole notes long, but the 3rd, 4th and 5th phrases are less than such, and they did this to save space in the rom. ------------------------------------------------ 2A) PHRASE FORMAT ------------------------------------------------ Bytes that point to each of the phrases of the overworld song are at 1A02F-1A064. 0x1A030 = Pointer for the first note of the dominant square channel in the song. This pointer should read "73 A0". it points to location 0x1A083, which is the first note of the first phrase in the song from square 1. Following this pointer are 3 bytes. The first of these denotes the location of the first note of the first phrase of the triangle channel; the second is the location of the first note of the first phrase square 2 channel and the third is that of the noise channel. 0x1A030 we have 73 A0 4B 27 68 First note from Square 1 is at 1A083, as defined by the pointer "73 A0" First note from Square 2 is at 1A09A, when we add "27" to "1A083" First note from Triangle is at 1A0BE, when we add "4B" to "1A083" First note from Noise Channel is at 1A0DB, when we add "68" to "1A083" The part of the 1st phrase played by the Square 1 channel is 27 bytes long, at 1A083-1A099. These 27 bytes are its notation. To see each byte functions as a note, see Part III of this document. ------------------------------------------------ 2B) PHRASE ORDER ------------------------------------------------ There are tables which indicate the order in which the musical phrases are playing. the one for the over world song is at 1A011-1A025. Followed by that is that of the cave song, which is only four bytes, and then a single byte for the jingle that plays when Link picks up an item or gets a level up. Another table like this exists at about 0x1A662 or so, for a few more songs, such as the palace theme. The overworld theme should look like this: 25 25 2B 31 2B 37 3D 3D 43 49 43 4F These numbers mean how many bytes away the phrase pointers are (the ones explained in section 2B) from, well, 0x1A00A apparently. This table does not include the first phrase. I have no idea why, but maybe the fact that it is not part of the song when it loops may have something to do with it. When looking for phrase orders, just look for tables like these. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX III. NOTATION XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Notes for songs in Zelda 2 are represented one byte at a time. The duration of a note is indicated by the value of the first, sixth, and seventh bits. Pitch is defined by the values of the second, third, fourth, and fifth bits. Exactly how notation is determined in this manner, see below. ------------------------------------------------ 3A) PITCH ------------------------------------------------ Adding one of the following values from the list below to a note will give it a corresponding pitch. Just keep in mind: the higher the value you add, the higher the pitch. 02- REST 04- E 06- F 08- F# 0A- G 0C- G# 0E- A 10- A# 12- B 14- C 16- C# 18- D 1A- D# 1C- E 1E- F 20- G# 22- A 24- A# 26- B 28- C 2A- C# 2C- D 2E- D# 30- E 32- F 34- F# 36- G 38- G# 3A- A 3C- A# 3E- B ------------------------------------------------ 3B) DURATION ------------------------------------------------ In its rawest form, a note is a 1/16 note: no more, no less. A notes duration will depend how much you will add to each note: add 00 : 1/16 add 81 : 3/32 add 80 : 1/8 add 40 : 3/16 add C0 : 1/4 add c1 : 3/8 add 41 : 1/2 add 01 : ??? Not sure what monkey decided to program it that way, but that's how it works. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX IV. TIMBRE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX By "timbre" I mean the quality of sound used, e.g. the quality of noise made bt the "musical instruments" in the game. Unless one decided to hack the way timbre is stored in the game's music, Timbre is the same in every song, except the title screen. However, you can at least alter the timbre for the two square channels to whatever you want them to be within the limits of the engine. The timbre for the two square channels is defined at 19145-1915C. All these bytes have 9 as the first nybble. This is the timbre! The second nybble is for the volume. Notice it increases with each byte. This is what gives Zelda 2 that echoing noise in its music. By default, both square 1 and square 2 have the same exact timbre. But this can be changed! There is a pointer for each square channel, and they both point to the table at 19145 mentioned above. I'll just let you know where the pointers are: 0x 19CE6 : "35 91" pointer for the Square 1 channel 0x 19D44 : "35 91" pointer for the Square 2 channel What you can do is copy the table at 19145-1915C to an empty space in the rom (a place with a bunch of FFs), make one of the pointers point to that new table, and alter the table. There you go, now your square channels have different timbres! ******************************************************************************* That's all for now...